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=`

/**
 * 加密
 * @param {*} content 
 * @returns 
 */
export function encryptHandler(content) {
    var encryptor = new JSEncrypt()
    encryptor.setPublicKey(publicKey)
    return encryptor.encrypt(content)
}
/**
 * 解密
 * @param {*} content 
 * @returns 
 */
export function decryptHandler(content) {
    var encryptor = new JSEncrypt()
    encryptor.setPrivateKey(privateKey)
    return encryptor.decrypt(content)
}